﻿@using Telerik.Web.Mvc.UI
@{
    ViewBag.Title = T("Admin.Promotions.Campaigns").Text;
}
<div class="section-header">
    <div class="title">
        <i class="fa fa-bullhorn"></i>
        @T("Admin.Promotions.Campaigns")
    </div>
    <div class="options">
		<a href="@Url.Action("Create")" class="btn btn-primary">
			<i class="fa fa-plus"></i>
			<span>@T("Admin.Common.AddNew")</span>
		</a>
    </div>
</div>
<div>
	@(Html.Telerik().Grid<CampaignModel>()
		.Name("campaigns-grid")
		.Columns(columns =>
		{
			columns.Bound(x => x.Name)
				.Template(x => Html.ActionLink(x.Name, "Edit", new { id = x.Id }))
				.ClientTemplate("<a href=\"Edit/<#= Id #>\"><#= Name #></a>");
			columns.Bound(x => x.Subject);
			columns.Bound(x => x.CreatedOn);
			columns.Bound(x => x.LimitedToStores)
				.Template(item => @Html.SymbolForBool(item.LimitedToStores))
				.ClientTemplate(@Html.SymbolForBool("LimitedToStores"))
				.Hidden((int)ViewData["StoreCount"] <= 1)
				.Centered();
		})
		.DataBinding(dataBinding => dataBinding.Ajax().Select("List", "Campaign"))
		.PreserveGridState()
		.EnableCustomBinding(true))
</div>